/*
** cmd_graph.c for  in /home/faye_m//zappy-2011/new_server/src
** 
** Made by mouhamed faye
** Login   <faye_m@epitech.net>
** 
** Started on  Tue Jul  5 15:41:11 2011 mouhamed faye
** Last update Sun Jul 10 22:15:55 2011 vincent ricard
*/
#include<string.h>
#include <strings.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "types.h"
#include "parser.h"
#include "cmd_graph.h"

tab_cmd_graph		which_cmd[10] =
  {
    {"msz", format_msz},
    {"bct X Y", format_bct},
    {"mct", format_mct},
    {"tna", format_tna},
    {"ppo # n", format_ppo},
    {"plv", format_plv},
    {"pln", format_pln},
    {"sgt", format_sgt},
    {"sst T", format_sst},
    {0, 0}
  };

void	cmd_graph(T_env *e, int socket, t_server_params *p)
{
  int i;
  i = 0;
  while (which_cmd[i].cmd != 0)
    {
      if (strcmp(e->buf, which_cmd[i].cmd) == 0)
	{
	  which_cmd[i].format(e, p);
	  return ;
	}
      else
	i++;
    }
  cmd_text(e, socket, p);
  bzero(e->buf, strlen(e->buf));
  return ;
}
